import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {render} from "@/utils/common/renderUtils";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '前段/后段',
    align: "center",
    dataIndex: 'level',
    customRender: ({ text }) => {
      return render.renderDict(text, 'level_code');
    },
  },
  {
    title: '工序',
    align:"center",
    dataIndex: 'proces'
  },
  {
    title: '客户名称',
    align:"center",
    dataIndex: 'customName',
  },
   {
    title: '产品名称',
    align:"center",
    dataIndex: 'productName',
   },
  {
    title: '作业指导书编号',
    align:"center",
    dataIndex: 'productNumber',
  },
  {
    title: '作业指导书',
    align:"center",
    dataIndex: 'pdf',
  },
  {
    title: '创建人',
    align:"center",
    dataIndex: 'realname',
  },
  {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    field: 'proces',
    label: '工序',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'customName',
    label: '客户名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'productName',
    label: '产品名称',
    component: 'Input',
    colProps: { span: 6 },
  },

];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '前段/后段',
    field: 'level',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'level_code',
      placeholder: '请选择前段/后段',
      stringToNumber: true,
    },
  },
  {
    label: '工序',
    field: 'proces',
    component: 'Input',
  },
  {
    label: '客户名称',
    field: 'customName',
    component: 'Input',
  },
  {
    label: '产品名称',
    field: 'productName',
    component: 'Input',
  },
  {
    label: '作业指导书编号',
    field: 'productNumber',
    component: 'Input',
  },
  {
    label: '作业指导书',
    field: 'pdf',
    component: 'JUpload',
    componentProps:{
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  proces: {title: '工序',order: 0,view: 'text', type: 'string',},
  customName: {title: '客户名称',order: 1,view: 'text', type: 'string',},
  productName: {title: '产品名称',order: 1,view: 'text', type: 'string',},

};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
